package com.ruoyi.cpi.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.cpi.domain.Month;
import com.ruoyi.cpi.service.IMonthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/month/month")
public class MonthController extends BaseController {
    @Autowired
    private IMonthService monthService;

    /**
     * 查询月份列表
     */
    @PreAuthorize("@ss.hasPermi('month:month:list')")
    @GetMapping("/list")
    public TableDataInfo list(Month month)
    {
        startPage();
        QueryWrapper<Month> queryWrapper=new QueryWrapper<>();
        if (month.getMname()!=null&&!"".equals(month.getMname())){
            queryWrapper.like("mname",month.getMname());
        }
        List<Month> list = monthService.list(queryWrapper);
        return getDataTable(list);
    }

}
